#include<iostream>
using namespace std;
#include<limits.h>
int main() {
	int n;
	cin >> n;
	int vec[100000], ans = INT_MAX, now;
	for (int i = 0; i < n; ++i)
		cin >> vec[i];
	int arr[100000];
	for (int i = 1; i <= 1000000; ++i) {
		now = 0;
		now += vec[0] != i;
		now += vec[1] != i;
		arr[0] = arr[1] = i;
		for (int i = 2; i < n; ++i) {
			arr[i] = arr[i - 1] + arr[i - 2];
			if (arr[i] > 1000000) {
				now += n - i;
				break;
			}
			now += arr[i] != vec[i];
		}
		ans = min(now, ans);
	}
	cout << ans;
}